import request from '@/cfsheep/request';

const AuthUtil = {
   
  // 登出系统
  logout: () => {
    return request({
      url: '/ucenter/cfAuth/logout',
      method: 'GET',
    });
  },
  // 刷新令牌
  refreshToken: (refreshToken) => {
    return request({
      url: '/ucenter/cfAuth/flushToken',
      method: 'GET',
      
      custom: {
        loading: false, // 不用加载中
        showError: false, // 不展示错误提示
      },
    });
  }, 
  // 微信小程序的一键登录
  weixinMiniAppLogin: (data) => {
    return request({
      url: '/ucenter/cfAuth/getWxBaseUserInfoByCodeAndLoginType',
      method: 'GET',
      data ,
      custom: {
        showSuccess: true,
        loadingMsg: '登陆中',
        successMsg: '登录成功',
      },
    });
  },
  // 获取手机号
  updateUserMobileByWeixin: (data) => {
    return request({
      url: '/ucenter/cfAuth/getUserPhonenumberByCodeAndLoginType',
      method: 'GET',
      data ,
      custom: {
        showSuccess: true, 
      },
    });
  },
  // 创建微信 JS SDK 初始化所需的签名
  createWeixinMpJsapiSignature: (url) => {
    return request({
      url: '/member/auth/create-weixin-jsapi-signature',
      method: 'POST',
      params: {
        url
      },
      custom: {
        showError: false,
        showLoading: false,
      },
    })
  },
  //
};

export default AuthUtil;
